< previous page page_877 next page >

Page 877
Extract From String
    Else                                                    ' WinNT Does NOT
arrow.gifNull Terminate String...
        tmpVal = Left(tmpVal, KeyValSize)                   ' Null Not Found,
arrow.gifExtract String Only
    End If
    '------------------------------------------------------------
    ' Determine Key Value Type For Conversion...
    '------------------------------------------------------------
    Select Case KeyValType                                  ' Search Data
arrow.gifTypes...
    Case REG_SZ                                             ' String Registry
arrow.gifKey Data Type
        KeyVal = tmpVal                                     ' Copy String Value
    Case REG_DWORD                                          ' Double Word
arrow.gifRegistry Key Data Type
        For i = Len(tmpVal) To 1 Step -1                    ' Convert Each Bit
            KeyVal = KeyVal + Hex(Asc(Mid(tmpVal, i, 1)))   ' Build Value Char.
arrow.gifBy Char.
        Next
        KeyVal = Format$("&h" + KeyVal)                     ' Convert Double
arrow.gifWord To String
    End Select

    GetKeyValue = True                                      ' Return Success
    rc = RegCloseKey(hKey)                                  ' Close Registry Key
    Exit Function                                           ' Exit

GetKeyError:      ' Cleanup After An Error Has Occured...
    KeyVal = ""                                             ' Set Return Val To
arrow.gifEmpty String
    GetKeyValue = False                                     ' Return Failure
    rc = RegCloseKey(hKey)                                  ' Close Registry Key
End Function
Now add one more new routine to call the GetKeyValue method. Add StartSysInfo to your project and enter the code in Listing A.6.
Type.gifListing A.6. Coding the StartSysInfo subroutine.
Public Sub StartSysInfo()
    On Error GoTo SysInfoErr

    Dim rc As Long
    Dim SysInfoPath As String

    ' Try To Get System Info Program Path\Name From Registry...
    If GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFO, gREGVALSYSINFO,
SysInfoPath) Then
    ' Try To Get System Info Program Path Only From Registry...
    ElseIf GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFOLOC, gREGVALSYSINFOLOC, SysInfoPath) Then
continues

 
< previous page page_877 next page >

If you like this book, buy it!